package com.sh.studytwo;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;


public class ButtonEnableActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btn_test;
    private TextView res;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_button_enable);
        Button enable = findViewById(R.id.btn_enable);
        Button unable = findViewById(R.id.btn_unable);
        btn_test = findViewById(R.id.btn_test);
        res = findViewById(R.id.btn_enable_res);

        enable.setOnClickListener(this);
        unable.setOnClickListener(this);
        btn_test.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.btn_enable) {
            btn_test.setEnabled(true);
        } else if (v.getId() == R.id.btn_unable) {
            btn_test.setEnabled(false);
        }else if (v.getId() == R.id.btn_test){
            res.setText("可以用的结果");
        }
    }


}